<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('电子名片业务填报类型配置积分明细列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <input type="hidden" name="configId" id="configId" th:value="${configId}"/>
                    <input type="hidden" name="busiType" id="busiType" th:value="${busiType}"/>
                    <input type="hidden" name="busiCode" id="busiCode" th:value="${busiCode}"/>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="add()" shiro:hasPermission="ecard:config:busiConfigList:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="ecard:config:busiConfigList:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ecard:config:busiConfigList:export">
                <i class="fa fa-download"></i> 导出
            </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ecard:config:busiConfigList:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ecard:config:busiConfigList:remove')}]];
    var prefix = ctx + "ecard/config/busiConfigList";
    var busiCode = $("#busiCode").val();
    var dpsTypeDatas = [];
    var loanTypeDatas = [];
    var termDatas = [];
    var perSocialTypeDatas = [[${@dict.getType('ecard_busi_per_social_type')}]];
    var othPrdTypeDatas = [[${@dict.getType('ecard_busi_oth_prd_type')}]];
    if (busiCode == 'busi_per_deposit'){
        dpsTypeDatas = [[${@dict.getType('ecard_busi_per_deposit_type')}]];
        termDatas = [[${@dict.getType('ecard_busi_per_deposit_term')}]];
    } else if (busiCode == 'busi_pub_deposit'){
        dpsTypeDatas = [[${@dict.getType('ecard_busi_pub_deposit_type')}]];
        termDatas = [[${@dict.getType('ecard_busi_pub_deposit_term')}]];
    } else if (busiCode == 'busi_per_loan'){
        loanTypeDatas = [[${@dict.getType('ecard_busi_per_loan_type')}]];
        termDatas = [[${@dict.getType('ecard_busi_per_loan_term')}]];
    } else if (busiCode == 'busi_pub_loan'){
        loanTypeDatas = [[${@dict.getType('ecard_busi_pub_loan_type')}]];
        termDatas = [[${@dict.getType('ecard_busi_pub_loan_term')}]];
    }
    $(function () {
        var busiCode = $("#busiCode").val();
        if (busiCode == 'busi_per_deposit' || busiCode == 'busi_pub_deposit') {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "电子名片业务填报类型配置积分明细",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: '主键ID',
                        visible: false
                    },
                    {
                        field: 'configId',
                        title: '规则编号'
                    },
                    {
                        field: 'dpsType',
                        title: '存款类型',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(dpsTypeDatas, value);
                        }
                    },
                    {
                        field: 'term',
                        title: '存款期限',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(termDatas, value);
                        }
                    },
                    {
                        field: 'minAmt',
                        title: '额度下限(含)'
                    },
                    {
                        field: 'maxAmt',
                        title: '额度上限'
                    },
                    {
                        field: 'nums',
                        title: '积分/比例'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }]
            };
            $.table.init(options);
        } else if (busiCode == 'busi_per_loan' || busiCode == 'busi_pub_loan'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "电子名片业务填报类型配置积分明细",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: '主键ID',
                        visible: false
                    },
                    {
                        field: 'configId',
                        title: '规则编号'
                    },
                    {
                        field: 'loanType',
                        title: '贷款类型',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(loanTypeDatas, value);
                        }
                    },
                    {
                        field: 'term',
                        title: '贷款期限',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(termDatas, value);
                        }
                    },
                    {
                        field: 'minRate',
                        title: '利率下限(含)'
                    },
                    {
                        field: 'maxRate',
                        title: '利率上限'
                    },
                    {
                        field: 'minAmt',
                        title: '额度下限(含)'
                    },
                    {
                        field: 'maxAmt',
                        title: '额度上限'
                    },
                    {
                        field: 'nums',
                        title: '积分/比例'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }]
            };
            $.table.init(options);
        } else if (busiCode == 'busi_per_social_security'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "电子名片业务填报类型配置积分明细",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: '主键ID',
                        visible: false
                    },
                    {
                        field: 'configId',
                        title: '规则编号'
                    },
                    {
                        field: 'perSocialType',
                        title: '社保卡类别',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(perSocialTypeDatas, value);
                        }
                    },
                    {
                        field: 'nums',
                        title: '积分/比例'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }]
            };
            $.table.init(options);
        } else if (busiCode == 'busi_pub_International'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "电子名片业务填报类型配置积分明细",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: '主键ID',
                        visible: false
                    },
                    {
                        field: 'configId',
                        title: '规则编号'
                    },
                    {
                        field: 'minAmt',
                        title: '额度下限(含)'
                    },
                    {
                        field: 'maxAmt',
                        title: '额度上限'
                    },
                    {
                        field: 'nums',
                        title: '积分/比例'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }]
            };
            $.table.init(options);
        } else if (busiCode == 'busi_oth_precious_metals'){
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "电子名片业务填报类型配置积分明细",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'id',
                        title: '主键ID',
                        visible: false
                    },
                    {
                        field: 'configId',
                        title: '规则编号'
                    },
                    {
                        field: 'othPrdType',
                        title: '产品类型',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(othPrdTypeDatas, value);
                        }
                    },
                    {
                        field: 'minAmt',
                        title: '额度下限(含)'
                    },
                    {
                        field: 'maxAmt',
                        title: '额度上限'
                    },
                    {
                        field: 'nums',
                        title: '积分/比例'
                    },
                    {
                        field: 'remark',
                        title: '备注说明'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }]
            };
            $.table.init(options);
        }
    });

    function add() {
        var configId = $("#configId").val();
        var busiType = $("#busiType").val();
        var busiCode = $("#busiCode").val();
        var createUrl = prefix + "/add/" + configId + '/' + busiType + '/' + busiCode;
        $.modal.open("新增积分配置信息", createUrl);
    }
    function edit(id) {
        var configId = $("#configId").val();
        var busiType = $("#busiType").val();
        var busiCode = $("#busiCode").val();
        var createUrl = prefix + "/edit/" + id + '/' + configId + '/' + busiType + '/' + busiCode;
        $.modal.open("编辑积分配置信息", createUrl);
    }
</script>
</body>
</html>